<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CPP11ThreadPool: ThreadPoolExecutor类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="CPP.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">CPP11ThreadPool
   </div>
   <div id="projectbrief">C++11线程池</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pro-methods">Protected 成员函数</a> &#124;
<a href="#pro-attribs">Protected 属性</a> &#124;
<a href="classThreadPoolExecutor-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">ThreadPoolExecutor类 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p>线程池基本实现,每个线程都有一个任务队列  
 <a href="classThreadPoolExecutor.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="threadpoolexecutor_8hpp_source.html">threadpoolexecutor.hpp</a>&gt;</code></p>
<div class="dynheader">
类 ThreadPoolExecutor 继承关系图:</div>
<div class="dyncontent">
<div class="center"><img src="classThreadPoolExecutor__inherit__graph.png" border="0" usemap="#ThreadPoolExecutor_inherit__map" alt="Inheritance graph"/></div>
<map name="ThreadPoolExecutor_inherit__map" id="ThreadPoolExecutor_inherit__map">
<area shape="rect" id="node2" href="classScheduledThreadPoolExecutor.html" title="定时任务调度线程池,最大线程数和核心线程数相等 " alt="" coords="5,80,207,107"/>
<area shape="rect" id="node3" href="classWorkStealingThreadPoolExecutor.html" title="任务窃取线程池,从下一个线程的任务队列窃取任务 " alt="" coords="231,80,450,107"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">图例</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a212b34b7e25e9eba4e096473a1b81f9e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a212b34b7e25e9eba4e096473a1b81f9e">ThreadPoolExecutor</a> (int32_t corePoolSize, int32_t maxPoolSize, const std::vector&lt; <a class="el" href="classBlockingQueue.html">BlockingQueue</a>&lt; <a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> &gt;&gt; &amp;workQueue, const <a class="el" href="classRejectedExecutionHandler.html">RejectedExecutionHandler</a> &amp;handler, const std::string &amp;prefix=&quot;&quot;)</td></tr>
<tr class="memdesc:a212b34b7e25e9eba4e096473a1b81f9e"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classThreadPoolExecutor.html" title="线程池基本实现,每个线程都有一个任务队列 ">ThreadPoolExecutor</a> 构造函数,workQueue的大小要不大于corePoolSize 每个线程根据顺序将对应位置的BlockingQueue&lt;Runnable&gt; 作为自己的任务队列 会抛出异常  <a href="#a212b34b7e25e9eba4e096473a1b81f9e">更多...</a><br /></td></tr>
<tr class="separator:a212b34b7e25e9eba4e096473a1b81f9e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab750236e7b95489a1cb66d4b026717fc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ab750236e7b95489a1cb66d4b026717fc">ThreadPoolExecutor</a> (int32_t corePoolSize, int32_t maxPoolSize, const std::vector&lt; <a class="el" href="classBlockingQueue.html">BlockingQueue</a>&lt; <a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> &gt;&gt; &amp;workQueue, <a class="el" href="classRejectedExecutionHandler.html">RejectedExecutionHandler</a> *handler, const std::string &amp;prefix=&quot;&quot;)</td></tr>
<tr class="memdesc:ab750236e7b95489a1cb66d4b026717fc"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classThreadPoolExecutor.html" title="线程池基本实现,每个线程都有一个任务队列 ">ThreadPoolExecutor</a> 构造函数,workQueue的大小要不大于corePoolSize 每个线程根据顺序将对应位置的BlockingQueue&lt;Runnable&gt; 作为自己的任务队列 会抛出异常  <a href="#ab750236e7b95489a1cb66d4b026717fc">更多...</a><br /></td></tr>
<tr class="separator:ab750236e7b95489a1cb66d4b026717fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a071bcc9eb42b365e2ce28a32938d422e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a071bcc9eb42b365e2ce28a32938d422e">ThreadPoolExecutor</a> (int32_t corePoolSize, int32_t maxPoolSize, const std::string &amp;prefix=&quot;&quot;)</td></tr>
<tr class="memdesc:a071bcc9eb42b365e2ce28a32938d422e"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classThreadPoolExecutor.html" title="线程池基本实现,每个线程都有一个任务队列 ">ThreadPoolExecutor</a> 构造函数,根据corePoolSize构造相同大小的workQueue 每个线程根据顺序将对应位置的BlockingQueue&lt;Runnable&gt; 作为自己的任务队列 会抛出异常  <a href="#a071bcc9eb42b365e2ce28a32938d422e">更多...</a><br /></td></tr>
<tr class="separator:a071bcc9eb42b365e2ce28a32938d422e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1d5a1c3330593f243959256d32068c15"><td class="memItemLeft" align="right" valign="top"><a id="a1d5a1c3330593f243959256d32068c15"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a1d5a1c3330593f243959256d32068c15">~ThreadPoolExecutor</a> ()</td></tr>
<tr class="memdesc:a1d5a1c3330593f243959256d32068c15"><td class="mdescLeft">&#160;</td><td class="mdescRight">~ThreadPoolExecutor 析构函数 <br /></td></tr>
<tr class="separator:a1d5a1c3330593f243959256d32068c15"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac2aa11f7cde6e6082eb0dde8f2385dce"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ac2aa11f7cde6e6082eb0dde8f2385dce">keepNonCoreThreadAlive</a> () const final</td></tr>
<tr class="memdesc:ac2aa11f7cde6e6082eb0dde8f2385dce"><td class="mdescLeft">&#160;</td><td class="mdescRight">nonCoreThreadAlive 是否允许非核心线程超时,若允许则线程执行完 一个任务后不会退出,会继续存在  <a href="#ac2aa11f7cde6e6082eb0dde8f2385dce">更多...</a><br /></td></tr>
<tr class="separator:ac2aa11f7cde6e6082eb0dde8f2385dce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7e6ed2d088147377d1e82018ac3dac1d"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a7e6ed2d088147377d1e82018ac3dac1d">keepNonCoreThreadAlive</a> (bool value) final</td></tr>
<tr class="memdesc:a7e6ed2d088147377d1e82018ac3dac1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">keepNonCoreThreadAlive 设置是否允许非核心thread超时并且在没有任务时终止  <a href="#a7e6ed2d088147377d1e82018ac3dac1d">更多...</a><br /></td></tr>
<tr class="separator:a7e6ed2d088147377d1e82018ac3dac1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a280379699ff72325cc4ccaf491e50967"><td class="memItemLeft" align="right" valign="top"><a id="a280379699ff72325cc4ccaf491e50967"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a280379699ff72325cc4ccaf491e50967">releaseNonCoreThreads</a> ()</td></tr>
<tr class="memdesc:a280379699ff72325cc4ccaf491e50967"><td class="mdescLeft">&#160;</td><td class="mdescRight">releaseNonCoreThreads 释放非核心线程(释放线程资源,并弹出线程队列) 如果keepNonCoreThreadAlive=false, 那么非核心线程会自动退出 执行时会将keepNonCoreThreadAlive设为false, 释放所有非核心线程 <br /></td></tr>
<tr class="separator:a280379699ff72325cc4ccaf491e50967"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0a471dc0a68b70d99d8215565a4df688"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a0a471dc0a68b70d99d8215565a4df688">setRejectedExecutionHandler</a> (<a class="el" href="classRejectedExecutionHandler.html">RejectedExecutionHandler</a> handler) final</td></tr>
<tr class="memdesc:a0a471dc0a68b70d99d8215565a4df688"><td class="mdescLeft">&#160;</td><td class="mdescRight">setRejectedExecutionHandler 设置新的任务拒绝策略  <a href="#a0a471dc0a68b70d99d8215565a4df688">更多...</a><br /></td></tr>
<tr class="separator:a0a471dc0a68b70d99d8215565a4df688"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4dac3c2435919af5d77aa36069d35bc7"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a4dac3c2435919af5d77aa36069d35bc7">execute</a> (<a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> command, bool core=true)</td></tr>
<tr class="memdesc:a4dac3c2435919af5d77aa36069d35bc7"><td class="mdescLeft">&#160;</td><td class="mdescRight">execute 在将来某个时候执行给定的任务,无返回值, 任务可以在新线程或现有的合并的线程中执行, 向任务队列提交的是任务副本 不会抛出异常  <a href="#a4dac3c2435919af5d77aa36069d35bc7">更多...</a><br /></td></tr>
<tr class="separator:a4dac3c2435919af5d77aa36069d35bc7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a523df0545790ef03a82623b05e3b20f9"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a523df0545790ef03a82623b05e3b20f9">execute</a> (<a class="el" href="classRunnable.html">Runnable</a> &amp;command, bool core=true)</td></tr>
<tr class="memdesc:a523df0545790ef03a82623b05e3b20f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">execute 在将来某个时候执行给定的任务,无返回值, 任务可以在新线程或现有的合并的线程中执行, 向任务队列提交的是任务副本 不会抛出异常  <a href="#a523df0545790ef03a82623b05e3b20f9">更多...</a><br /></td></tr>
<tr class="separator:a523df0545790ef03a82623b05e3b20f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a451bba3f90dbed2ba7e491ebc391b3c6"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a451bba3f90dbed2ba7e491ebc391b3c6">execute</a> (<a class="el" href="classBlockingQueue.html">BlockingQueue</a>&lt; <a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> &gt; &amp;commands, bool core=true)</td></tr>
<tr class="memdesc:a451bba3f90dbed2ba7e491ebc391b3c6"><td class="mdescLeft">&#160;</td><td class="mdescRight">execute 在将来某个时候执行给定的任务,无返回值, 任务可以在新线程或现有的合并的线程中执行, 向任务队列提交的是任务副本 不会抛出异常  <a href="#a451bba3f90dbed2ba7e491ebc391b3c6">更多...</a><br /></td></tr>
<tr class="separator:a451bba3f90dbed2ba7e491ebc391b3c6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a94834ab6bedcc75111524fec4e928b3f"><td class="memTemplParams" colspan="2">template&lt;typename F &gt; </td></tr>
<tr class="memitem:a94834ab6bedcc75111524fec4e928b3f"><td class="memTemplItemLeft" align="right" valign="top">std::future&lt; typename std::result_of&lt; F()&gt;::type &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a94834ab6bedcc75111524fec4e928b3f">submit</a> (F f, bool core=true)</td></tr>
<tr class="memdesc:a94834ab6bedcc75111524fec4e928b3f"><td class="mdescLeft">&#160;</td><td class="mdescRight">submit 在将来某个时候执行给定的任务, 任务可以在新线程或现有的合并的线程中执行, 可以有返回值,向任务队列提交的是任务副本 会抛出异常  <a href="#a94834ab6bedcc75111524fec4e928b3f">更多...</a><br /></td></tr>
<tr class="separator:a94834ab6bedcc75111524fec4e928b3f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8e340cec3bb976f7773db103d73189c2"><td class="memItemLeft" align="right" valign="top">virtual std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a8e340cec3bb976f7773db103d73189c2">toString</a> () const</td></tr>
<tr class="memdesc:a8e340cec3bb976f7773db103d73189c2"><td class="mdescLeft">&#160;</td><td class="mdescRight">toString 返回标识此池的字符串及其状态，包括运行状态和估计的Worker和任务计数的指示  <a href="#a8e340cec3bb976f7773db103d73189c2">更多...</a><br /></td></tr>
<tr class="separator:a8e340cec3bb976f7773db103d73189c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9345329aa167200bec31951d2f5a690"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ac9345329aa167200bec31951d2f5a690">getActiveCount</a> () const final</td></tr>
<tr class="memdesc:ac9345329aa167200bec31951d2f5a690"><td class="mdescLeft">&#160;</td><td class="mdescRight">getActiveCount 返回正在执行任务的线程的大概数量 也就是非空闲线程数量  <a href="#ac9345329aa167200bec31951d2f5a690">更多...</a><br /></td></tr>
<tr class="separator:ac9345329aa167200bec31951d2f5a690"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a61e8321202e6b0f6ea014485e8e10450"><td class="memItemLeft" align="right" valign="top">virtual long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a61e8321202e6b0f6ea014485e8e10450">getTaskCount</a> () const</td></tr>
<tr class="memdesc:a61e8321202e6b0f6ea014485e8e10450"><td class="mdescLeft">&#160;</td><td class="mdescRight">getTaskCount 得到任务队列大小  <a href="#a61e8321202e6b0f6ea014485e8e10450">更多...</a><br /></td></tr>
<tr class="separator:a61e8321202e6b0f6ea014485e8e10450"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac5a10d336958ca43530b31bff81c9c4b"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ac5a10d336958ca43530b31bff81c9c4b">setMaxPoolSize</a> (int maxPoolSize) final</td></tr>
<tr class="memdesc:ac5a10d336958ca43530b31bff81c9c4b"><td class="mdescLeft">&#160;</td><td class="mdescRight">setMaxPoolSize 设置允许的最大线程数。 这将覆盖在构造函数中设置的任何值。 如果新值小于当前值，则过多的现有线程在下一个空闲时将被终止  <a href="#ac5a10d336958ca43530b31bff81c9c4b">更多...</a><br /></td></tr>
<tr class="separator:ac5a10d336958ca43530b31bff81c9c4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af630e5117b4f67428a4fcbee5c15a7d9"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#af630e5117b4f67428a4fcbee5c15a7d9">getEverPoolSize</a> () const final</td></tr>
<tr class="memdesc:af630e5117b4f67428a4fcbee5c15a7d9"><td class="mdescLeft">&#160;</td><td class="mdescRight">getLargestPoolSize 返回池中使用过的线程数  <a href="#af630e5117b4f67428a4fcbee5c15a7d9">更多...</a><br /></td></tr>
<tr class="separator:af630e5117b4f67428a4fcbee5c15a7d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af29377a50af53031bb06aeacf9ef27f7"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#af29377a50af53031bb06aeacf9ef27f7">getCorePoolSize</a> () const final</td></tr>
<tr class="memdesc:af29377a50af53031bb06aeacf9ef27f7"><td class="mdescLeft">&#160;</td><td class="mdescRight">getCorePoolSize 返回核心线程数  <a href="#af29377a50af53031bb06aeacf9ef27f7">更多...</a><br /></td></tr>
<tr class="separator:af29377a50af53031bb06aeacf9ef27f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaa834c4350d6b12826803bb13dd467ea"><td class="memItemLeft" align="right" valign="top"><a id="aaa834c4350d6b12826803bb13dd467ea"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#aaa834c4350d6b12826803bb13dd467ea">shutdown</a> () final</td></tr>
<tr class="memdesc:aaa834c4350d6b12826803bb13dd467ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">shutdown 不在接受新任务,并且在所有任务执行完后终止线程池 如果还有新任务提交将会触发拒绝策略,默认的拒绝策略会抛出异常 <br /></td></tr>
<tr class="separator:aaa834c4350d6b12826803bb13dd467ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a588ec33baf402afd0e1c52b11d9234da"><td class="memItemLeft" align="right" valign="top"><a id="a588ec33baf402afd0e1c52b11d9234da"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a588ec33baf402afd0e1c52b11d9234da">stop</a> () final</td></tr>
<tr class="memdesc:a588ec33baf402afd0e1c52b11d9234da"><td class="mdescLeft">&#160;</td><td class="mdescRight">stop 不在接受新任务,终止旧任务,释放正在运行的线程 <br /></td></tr>
<tr class="separator:a588ec33baf402afd0e1c52b11d9234da"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac33c356670eabe5345992331e615348c"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ac33c356670eabe5345992331e615348c">isShutDown</a> () final</td></tr>
<tr class="memdesc:ac33c356670eabe5345992331e615348c"><td class="mdescLeft">&#160;</td><td class="mdescRight">isShutDown 判断线程池是否shutdown  <a href="#ac33c356670eabe5345992331e615348c">更多...</a><br /></td></tr>
<tr class="separator:ac33c356670eabe5345992331e615348c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a89ed68d6c67ad6fbde73b7883c8107a7"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a89ed68d6c67ad6fbde73b7883c8107a7">isTerminated</a> () final</td></tr>
<tr class="memdesc:a89ed68d6c67ad6fbde73b7883c8107a7"><td class="mdescLeft">&#160;</td><td class="mdescRight">isTerminated 判断线程池是否terminated  <a href="#a89ed68d6c67ad6fbde73b7883c8107a7">更多...</a><br /></td></tr>
<tr class="separator:a89ed68d6c67ad6fbde73b7883c8107a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aab8b3946a87fbecd144b159c12c8bcfb"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#aab8b3946a87fbecd144b159c12c8bcfb">preStartCoreThreads</a> ()</td></tr>
<tr class="memdesc:aab8b3946a87fbecd144b159c12c8bcfb"><td class="mdescLeft">&#160;</td><td class="mdescRight">preStartCoreThreads 启动所有核心线程，导致他们等待工作。 这将覆盖仅在执行新任务时启动核心线程的默认策略  <a href="#aab8b3946a87fbecd144b159c12c8bcfb">更多...</a><br /></td></tr>
<tr class="separator:aab8b3946a87fbecd144b159c12c8bcfb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a14c4e3d786dcf22e858b11a95d2f77ef"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a14c4e3d786dcf22e858b11a95d2f77ef">reject</a> (const <a class="el" href="classRunnable.html">Runnable</a> &amp;command) final</td></tr>
<tr class="memdesc:a14c4e3d786dcf22e858b11a95d2f77ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">reject 将任务抛弃  <a href="#a14c4e3d786dcf22e858b11a95d2f77ef">更多...</a><br /></td></tr>
<tr class="separator:a14c4e3d786dcf22e858b11a95d2f77ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected 成员函数</h2></td></tr>
<tr class="memitem:a61774315237123faf8e7fcc9d35ae47d"><td class="memItemLeft" align="right" valign="top"><a id="a61774315237123faf8e7fcc9d35ae47d"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a61774315237123faf8e7fcc9d35ae47d">terminated</a> ()</td></tr>
<tr class="memdesc:a61774315237123faf8e7fcc9d35ae47d"><td class="mdescLeft">&#160;</td><td class="mdescRight">terminated 线程池终止时执行 <br /></td></tr>
<tr class="separator:a61774315237123faf8e7fcc9d35ae47d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7d4bfa422c41a11fcdd33e7a1b2bcec8"><td class="memItemLeft" align="right" valign="top"><a id="a7d4bfa422c41a11fcdd33e7a1b2bcec8"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a7d4bfa422c41a11fcdd33e7a1b2bcec8">releaseWorkers</a> ()</td></tr>
<tr class="memdesc:a7d4bfa422c41a11fcdd33e7a1b2bcec8"><td class="mdescLeft">&#160;</td><td class="mdescRight">releaseWorkers 释放所有线程(释放线程资源,并弹出线程队列) <br /></td></tr>
<tr class="separator:a7d4bfa422c41a11fcdd33e7a1b2bcec8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acdb626fdcb6ed4c7822508d1e0a3fcf5"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#acdb626fdcb6ed4c7822508d1e0a3fcf5">runStateOf</a> (int32_t c) const final</td></tr>
<tr class="memdesc:acdb626fdcb6ed4c7822508d1e0a3fcf5"><td class="mdescLeft">&#160;</td><td class="mdescRight">runStateOf 得到线程池状态  <a href="#acdb626fdcb6ed4c7822508d1e0a3fcf5">更多...</a><br /></td></tr>
<tr class="separator:acdb626fdcb6ed4c7822508d1e0a3fcf5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f842d070a584bbc16a693207a947aac"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a4f842d070a584bbc16a693207a947aac">workerCountOf</a> (int32_t c) const final</td></tr>
<tr class="memdesc:a4f842d070a584bbc16a693207a947aac"><td class="mdescLeft">&#160;</td><td class="mdescRight">workerCountOf 得到工作线程数量  <a href="#a4f842d070a584bbc16a693207a947aac">更多...</a><br /></td></tr>
<tr class="separator:a4f842d070a584bbc16a693207a947aac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a31ed7a73571c79c8dbb486f27a4df4eb"><td class="memItemLeft" align="right" valign="top">virtual int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a31ed7a73571c79c8dbb486f27a4df4eb">ctlOf</a> (int32_t rs, int32_t wc) const final</td></tr>
<tr class="memdesc:a31ed7a73571c79c8dbb486f27a4df4eb"><td class="mdescLeft">&#160;</td><td class="mdescRight">ctlOf 控制变量初始化  <a href="#a31ed7a73571c79c8dbb486f27a4df4eb">更多...</a><br /></td></tr>
<tr class="separator:a31ed7a73571c79c8dbb486f27a4df4eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa4eb0971fc6f352df594186b6a118d6c"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#aa4eb0971fc6f352df594186b6a118d6c">addWorker</a> (<a class="el" href="classRunnable.html">Runnable</a> task, bool core=true)</td></tr>
<tr class="memdesc:aa4eb0971fc6f352df594186b6a118d6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">addWorker 将任务添加到队列  <a href="#aa4eb0971fc6f352df594186b6a118d6c">更多...</a><br /></td></tr>
<tr class="separator:aa4eb0971fc6f352df594186b6a118d6c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9f108a305159ddf47923162f89a91a64"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a9f108a305159ddf47923162f89a91a64">addWorker</a> (<a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> task, bool core=true)</td></tr>
<tr class="memdesc:a9f108a305159ddf47923162f89a91a64"><td class="mdescLeft">&#160;</td><td class="mdescRight">addWorker 将任务添加到队列  <a href="#a9f108a305159ddf47923162f89a91a64">更多...</a><br /></td></tr>
<tr class="separator:a9f108a305159ddf47923162f89a91a64"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abaa3926310766a93b7fe1d83b77efdae"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#abaa3926310766a93b7fe1d83b77efdae">advanceRunState</a> (int32_t targetState) final</td></tr>
<tr class="memdesc:abaa3926310766a93b7fe1d83b77efdae"><td class="mdescLeft">&#160;</td><td class="mdescRight">advanceRunState 改变线程池状态  <a href="#abaa3926310766a93b7fe1d83b77efdae">更多...</a><br /></td></tr>
<tr class="separator:abaa3926310766a93b7fe1d83b77efdae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5e40839bf4191b5eab9d81227ddb62c3"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a5e40839bf4191b5eab9d81227ddb62c3">coreWorkerThread</a> (size_t queueIdex)</td></tr>
<tr class="memdesc:a5e40839bf4191b5eab9d81227ddb62c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">coreWorkerThread 核心线程循环  <a href="#a5e40839bf4191b5eab9d81227ddb62c3">更多...</a><br /></td></tr>
<tr class="separator:a5e40839bf4191b5eab9d81227ddb62c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a844902ce61fb16b11a569b8ee56e80e9"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a844902ce61fb16b11a569b8ee56e80e9">workerThread</a> (size_t queueIdex)</td></tr>
<tr class="memdesc:a844902ce61fb16b11a569b8ee56e80e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">workerThread 非核心线程循环  <a href="#a844902ce61fb16b11a569b8ee56e80e9">更多...</a><br /></td></tr>
<tr class="separator:a844902ce61fb16b11a569b8ee56e80e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a353e65b77bb3c0950ed79939473d4852"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a353e65b77bb3c0950ed79939473d4852">reject</a> (const <a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> command) final</td></tr>
<tr class="memdesc:a353e65b77bb3c0950ed79939473d4852"><td class="mdescLeft">&#160;</td><td class="mdescRight">reject 将任务抛弃  <a href="#a353e65b77bb3c0950ed79939473d4852">更多...</a><br /></td></tr>
<tr class="separator:a353e65b77bb3c0950ed79939473d4852"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a841ae2189d6f85b9df9f69dec5375341"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a841ae2189d6f85b9df9f69dec5375341">isRunning</a> (int c) const final</td></tr>
<tr class="memdesc:a841ae2189d6f85b9df9f69dec5375341"><td class="mdescLeft">&#160;</td><td class="mdescRight">isRunning 是否还在运行  <a href="#a841ae2189d6f85b9df9f69dec5375341">更多...</a><br /></td></tr>
<tr class="separator:a841ae2189d6f85b9df9f69dec5375341"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa12a3efb879080453fb7abc486585698"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#aa12a3efb879080453fb7abc486585698">runStateLessThan</a> (int c, int s) const final</td></tr>
<tr class="memdesc:aa12a3efb879080453fb7abc486585698"><td class="mdescLeft">&#160;</td><td class="mdescRight">runStateLessThan 状态低于  <a href="#aa12a3efb879080453fb7abc486585698">更多...</a><br /></td></tr>
<tr class="separator:aa12a3efb879080453fb7abc486585698"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a44ee48ed44faa12fc6373074e9059e4e"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a44ee48ed44faa12fc6373074e9059e4e">runStateAtLeast</a> (int c, int s) const final</td></tr>
<tr class="memdesc:a44ee48ed44faa12fc6373074e9059e4e"><td class="mdescLeft">&#160;</td><td class="mdescRight">runStateAtLeast 运行状态最少是  <a href="#a44ee48ed44faa12fc6373074e9059e4e">更多...</a><br /></td></tr>
<tr class="separator:a44ee48ed44faa12fc6373074e9059e4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac1bcafe65f800aeb9feade5f31b64fde"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ac1bcafe65f800aeb9feade5f31b64fde">compareAndIncrementWorkerCount</a> (int expect) final</td></tr>
<tr class="memdesc:ac1bcafe65f800aeb9feade5f31b64fde"><td class="mdescLeft">&#160;</td><td class="mdescRight">compareAndIncrementWorkerCount 尝试CAS递增ctl的workerCount字段.  <a href="#ac1bcafe65f800aeb9feade5f31b64fde">更多...</a><br /></td></tr>
<tr class="separator:ac1bcafe65f800aeb9feade5f31b64fde"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac40053b88cd669526a0a6225b5e1a86e"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ac40053b88cd669526a0a6225b5e1a86e">compareAndDecrementWorkerCount</a> (int expect) final</td></tr>
<tr class="memdesc:ac40053b88cd669526a0a6225b5e1a86e"><td class="mdescLeft">&#160;</td><td class="mdescRight">compareAndDecrementWorkerCount 尝试CAS递减ctl的workerCount字段.  <a href="#ac40053b88cd669526a0a6225b5e1a86e">更多...</a><br /></td></tr>
<tr class="separator:ac40053b88cd669526a0a6225b5e1a86e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab19dcfa8af5864274e66bccf40255484"><td class="memItemLeft" align="right" valign="top"><a id="ab19dcfa8af5864274e66bccf40255484"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ab19dcfa8af5864274e66bccf40255484">decrementWorkerCount</a> ()</td></tr>
<tr class="memdesc:ab19dcfa8af5864274e66bccf40255484"><td class="mdescLeft">&#160;</td><td class="mdescRight">decrementWorkerCount 减少ctl的workerCount字段 <br /></td></tr>
<tr class="separator:ab19dcfa8af5864274e66bccf40255484"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected 属性</h2></td></tr>
<tr class="memitem:af82bff422304406f59a14b5b638c2b42"><td class="memItemLeft" align="right" valign="top"><a id="af82bff422304406f59a14b5b638c2b42"></a>
const int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#af82bff422304406f59a14b5b638c2b42">COUNT_BITS</a> = 29</td></tr>
<tr class="memdesc:af82bff422304406f59a14b5b638c2b42"><td class="mdescLeft">&#160;</td><td class="mdescRight">初始化使用 <br /></td></tr>
<tr class="separator:af82bff422304406f59a14b5b638c2b42"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac96b726327ad0d07709085ab49c4f58"><td class="memItemLeft" align="right" valign="top"><a id="aac96b726327ad0d07709085ab49c4f58"></a>
const int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#aac96b726327ad0d07709085ab49c4f58">CAPACITY</a> = (1 &lt;&lt; <a class="el" href="classThreadPoolExecutor.html#af82bff422304406f59a14b5b638c2b42">COUNT_BITS</a>) - 1</td></tr>
<tr class="memdesc:aac96b726327ad0d07709085ab49c4f58"><td class="mdescLeft">&#160;</td><td class="mdescRight">线程池容量 <br /></td></tr>
<tr class="separator:aac96b726327ad0d07709085ab49c4f58"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9e28d5aa0cb4500921f7244565b8bed8"><td class="memItemLeft" align="right" valign="top"><a id="a9e28d5aa0cb4500921f7244565b8bed8"></a>
const int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a9e28d5aa0cb4500921f7244565b8bed8">RUNNING</a> = (-1 &lt;&lt; <a class="el" href="classThreadPoolExecutor.html#af82bff422304406f59a14b5b638c2b42">COUNT_BITS</a>)</td></tr>
<tr class="memdesc:a9e28d5aa0cb4500921f7244565b8bed8"><td class="mdescLeft">&#160;</td><td class="mdescRight">处于运行状态,RUNNING一定要初始化在ctl_之前,因为crl_用其初始化 <br /></td></tr>
<tr class="separator:a9e28d5aa0cb4500921f7244565b8bed8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa0958f2bf040bf2f199c629ec9145b44"><td class="memItemLeft" align="right" valign="top"><a id="aa0958f2bf040bf2f199c629ec9145b44"></a>
const int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#aa0958f2bf040bf2f199c629ec9145b44">SHUTDOWN</a> = 0 &lt;&lt; <a class="el" href="classThreadPoolExecutor.html#af82bff422304406f59a14b5b638c2b42">COUNT_BITS</a></td></tr>
<tr class="memdesc:aa0958f2bf040bf2f199c629ec9145b44"><td class="mdescLeft">&#160;</td><td class="mdescRight">不再接受新任务 <br /></td></tr>
<tr class="separator:aa0958f2bf040bf2f199c629ec9145b44"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae3c0ff657b3c0d8bbaf7f10bfdf587ca"><td class="memItemLeft" align="right" valign="top"><a id="ae3c0ff657b3c0d8bbaf7f10bfdf587ca"></a>
const int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ae3c0ff657b3c0d8bbaf7f10bfdf587ca">STOP</a> = 1 &lt;&lt; <a class="el" href="classThreadPoolExecutor.html#af82bff422304406f59a14b5b638c2b42">COUNT_BITS</a></td></tr>
<tr class="memdesc:ae3c0ff657b3c0d8bbaf7f10bfdf587ca"><td class="mdescLeft">&#160;</td><td class="mdescRight">不再接受新任务,队列中的任务将被抛弃 <br /></td></tr>
<tr class="separator:ae3c0ff657b3c0d8bbaf7f10bfdf587ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3d2a0964f6bce420433491da80000c4c"><td class="memItemLeft" align="right" valign="top"><a id="a3d2a0964f6bce420433491da80000c4c"></a>
const int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a3d2a0964f6bce420433491da80000c4c">TIDYING</a> = 2 &lt;&lt; <a class="el" href="classThreadPoolExecutor.html#af82bff422304406f59a14b5b638c2b42">COUNT_BITS</a></td></tr>
<tr class="memdesc:a3d2a0964f6bce420433491da80000c4c"><td class="mdescLeft">&#160;</td><td class="mdescRight">所有线程已经释放,任务队列为空,会调用terminated() <br /></td></tr>
<tr class="separator:a3d2a0964f6bce420433491da80000c4c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15bb29c714876435f3c59cd0137ac074"><td class="memItemLeft" align="right" valign="top"><a id="a15bb29c714876435f3c59cd0137ac074"></a>
const int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a15bb29c714876435f3c59cd0137ac074">TERMINATED</a> = 3 &lt;&lt; <a class="el" href="classThreadPoolExecutor.html#af82bff422304406f59a14b5b638c2b42">COUNT_BITS</a></td></tr>
<tr class="memdesc:a15bb29c714876435f3c59cd0137ac074"><td class="mdescLeft">&#160;</td><td class="mdescRight">线程池关闭,<a class="el" href="classThreadPoolExecutor.html#a61774315237123faf8e7fcc9d35ae47d" title="terminated 线程池终止时执行 ">terminated()</a>函数已经执行 <br /></td></tr>
<tr class="separator:a15bb29c714876435f3c59cd0137ac074"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac4496adc7a7ff18b97464a863fcf4a73"><td class="memItemLeft" align="right" valign="top"><a id="ac4496adc7a7ff18b97464a863fcf4a73"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ac4496adc7a7ff18b97464a863fcf4a73">corePoolSize_</a></td></tr>
<tr class="memdesc:ac4496adc7a7ff18b97464a863fcf4a73"><td class="mdescLeft">&#160;</td><td class="mdescRight">核心线程数 <br /></td></tr>
<tr class="separator:ac4496adc7a7ff18b97464a863fcf4a73"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7fb9fd51e0a4b27277012c16596b9137"><td class="memItemLeft" align="right" valign="top"><a id="a7fb9fd51e0a4b27277012c16596b9137"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a7fb9fd51e0a4b27277012c16596b9137">maxPoolSize_</a></td></tr>
<tr class="memdesc:a7fb9fd51e0a4b27277012c16596b9137"><td class="mdescLeft">&#160;</td><td class="mdescRight">最大线程数 <br /></td></tr>
<tr class="separator:a7fb9fd51e0a4b27277012c16596b9137"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a32da434f74911bcc1702eaafabfac368"><td class="memItemLeft" align="right" valign="top"><a id="a32da434f74911bcc1702eaafabfac368"></a>
unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a32da434f74911bcc1702eaafabfac368">submitId_</a> {0}</td></tr>
<tr class="memdesc:a32da434f74911bcc1702eaafabfac368"><td class="mdescLeft">&#160;</td><td class="mdescRight">提交任务的id <br /></td></tr>
<tr class="separator:a32da434f74911bcc1702eaafabfac368"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acf28232c8314da96403992137fdd1c2f"><td class="memItemLeft" align="right" valign="top"><a id="acf28232c8314da96403992137fdd1c2f"></a>
std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#acf28232c8314da96403992137fdd1c2f">prefix_</a></td></tr>
<tr class="memdesc:acf28232c8314da96403992137fdd1c2f"><td class="mdescLeft">&#160;</td><td class="mdescRight">线程名前缀 <br /></td></tr>
<tr class="separator:acf28232c8314da96403992137fdd1c2f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c8fc052c3760c89bf5198409d8c9c72"><td class="memItemLeft" align="right" valign="top"><a id="a2c8fc052c3760c89bf5198409d8c9c72"></a>
volatile bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a2c8fc052c3760c89bf5198409d8c9c72">keepNonCoreThreadAlive_</a> {false}</td></tr>
<tr class="memdesc:a2c8fc052c3760c89bf5198409d8c9c72"><td class="mdescLeft">&#160;</td><td class="mdescRight">是否允许非核心线程超时 <br /></td></tr>
<tr class="separator:a2c8fc052c3760c89bf5198409d8c9c72"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad8f4e68f28d617749537036f6e688b8c"><td class="memItemLeft" align="right" valign="top"><a id="ad8f4e68f28d617749537036f6e688b8c"></a>
std::atomic&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ad8f4e68f28d617749537036f6e688b8c">everPoolSize_</a> {0}</td></tr>
<tr class="memdesc:ad8f4e68f28d617749537036f6e688b8c"><td class="mdescLeft">&#160;</td><td class="mdescRight">曾经出现的线程数量,包括已经死亡的 <br /></td></tr>
<tr class="separator:ad8f4e68f28d617749537036f6e688b8c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ef0eea2a8ca7a03bd9d361ced31f71b"><td class="memItemLeft" align="right" valign="top"><a id="a2ef0eea2a8ca7a03bd9d361ced31f71b"></a>
std::mutex&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a2ef0eea2a8ca7a03bd9d361ced31f71b">mutex_</a></td></tr>
<tr class="memdesc:a2ef0eea2a8ca7a03bd9d361ced31f71b"><td class="mdescLeft">&#160;</td><td class="mdescRight">队列锁 <br /></td></tr>
<tr class="separator:a2ef0eea2a8ca7a03bd9d361ced31f71b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a010113b7aac17ef364d417c485263873"><td class="memItemLeft" align="right" valign="top"><a id="a010113b7aac17ef364d417c485263873"></a>
std::atomic_int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a010113b7aac17ef364d417c485263873">ctl_</a></td></tr>
<tr class="memdesc:a010113b7aac17ef364d417c485263873"><td class="mdescLeft">&#160;</td><td class="mdescRight">控制变量 <br /></td></tr>
<tr class="separator:a010113b7aac17ef364d417c485263873"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad523af8548ca8f1dae80cb295ee567b3"><td class="memItemLeft" align="right" valign="top"><a id="ad523af8548ca8f1dae80cb295ee567b3"></a>
std::condition_variable&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#ad523af8548ca8f1dae80cb295ee567b3">notEmpty_</a></td></tr>
<tr class="memdesc:ad523af8548ca8f1dae80cb295ee567b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">队列非空条件变量 <br /></td></tr>
<tr class="separator:ad523af8548ca8f1dae80cb295ee567b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a47dd74330fa41d01067943b1db74818a"><td class="memItemLeft" align="right" valign="top"><a id="a47dd74330fa41d01067943b1db74818a"></a>
std::vector&lt; <a class="el" href="classThread.html#a430059e402325caaf1ed185fb520c9d2">Thread::sptr</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a47dd74330fa41d01067943b1db74818a">threads_</a></td></tr>
<tr class="memdesc:a47dd74330fa41d01067943b1db74818a"><td class="mdescLeft">&#160;</td><td class="mdescRight">线程队列 <br /></td></tr>
<tr class="separator:a47dd74330fa41d01067943b1db74818a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a415491f8f40c0fcb99e7ec25cdd209d0"><td class="memItemLeft" align="right" valign="top"><a id="a415491f8f40c0fcb99e7ec25cdd209d0"></a>
std::vector&lt; <a class="el" href="classBlockingQueue.html">BlockingQueue</a>&lt; <a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a415491f8f40c0fcb99e7ec25cdd209d0">workQueues_</a></td></tr>
<tr class="memdesc:a415491f8f40c0fcb99e7ec25cdd209d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">任务队列 <br /></td></tr>
<tr class="separator:a415491f8f40c0fcb99e7ec25cdd209d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a347041db412b03aa09dd4e9b3beaa391"><td class="memItemLeft" align="right" valign="top"><a id="a347041db412b03aa09dd4e9b3beaa391"></a>
std::unique_ptr&lt; <a class="el" href="classRejectedExecutionHandler.html">RejectedExecutionHandler</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classThreadPoolExecutor.html#a347041db412b03aa09dd4e9b3beaa391">rejectHandler_</a></td></tr>
<tr class="memdesc:a347041db412b03aa09dd4e9b3beaa391"><td class="mdescLeft">&#160;</td><td class="mdescRight">拒绝策略回调 <br /></td></tr>
<tr class="separator:a347041db412b03aa09dd4e9b3beaa391"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>线程池基本实现,每个线程都有一个任务队列 </p>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="a212b34b7e25e9eba4e096473a1b81f9e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a212b34b7e25e9eba4e096473a1b81f9e">&#9670;&nbsp;</a></span>ThreadPoolExecutor() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ThreadPoolExecutor::ThreadPoolExecutor </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>corePoolSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>maxPoolSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::vector&lt; <a class="el" href="classBlockingQueue.html">BlockingQueue</a>&lt; <a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> &gt;&gt; &amp;&#160;</td>
          <td class="paramname"><em>workQueue</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classRejectedExecutionHandler.html">RejectedExecutionHandler</a> &amp;&#160;</td>
          <td class="paramname"><em>handler</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>prefix</em> = <code>&quot;&quot;</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p><a class="el" href="classThreadPoolExecutor.html" title="线程池基本实现,每个线程都有一个任务队列 ">ThreadPoolExecutor</a> 构造函数,workQueue的大小要不大于corePoolSize 每个线程根据顺序将对应位置的BlockingQueue&lt;Runnable&gt; 作为自己的任务队列 会抛出异常 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">corePoolSize</td><td>核心线程数 </td></tr>
    <tr><td class="paramname">maxPoolSize</td><td>最大线程数 </td></tr>
    <tr><td class="paramname">workQueue</td><td>任务队列 </td></tr>
    <tr><td class="paramname">handler</td><td>拒绝任务句柄 </td></tr>
    <tr><td class="paramname">prefix</td><td>线程名前缀 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ab750236e7b95489a1cb66d4b026717fc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab750236e7b95489a1cb66d4b026717fc">&#9670;&nbsp;</a></span>ThreadPoolExecutor() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ThreadPoolExecutor::ThreadPoolExecutor </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>corePoolSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>maxPoolSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::vector&lt; <a class="el" href="classBlockingQueue.html">BlockingQueue</a>&lt; <a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> &gt;&gt; &amp;&#160;</td>
          <td class="paramname"><em>workQueue</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classRejectedExecutionHandler.html">RejectedExecutionHandler</a> *&#160;</td>
          <td class="paramname"><em>handler</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>prefix</em> = <code>&quot;&quot;</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p><a class="el" href="classThreadPoolExecutor.html" title="线程池基本实现,每个线程都有一个任务队列 ">ThreadPoolExecutor</a> 构造函数,workQueue的大小要不大于corePoolSize 每个线程根据顺序将对应位置的BlockingQueue&lt;Runnable&gt; 作为自己的任务队列 会抛出异常 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">corePoolSize</td><td>核心线程数 </td></tr>
    <tr><td class="paramname">maxPoolSize</td><td>最大线程数 </td></tr>
    <tr><td class="paramname">workQueue</td><td>任务队列 </td></tr>
    <tr><td class="paramname">handler</td><td>拒绝任务句柄 </td></tr>
    <tr><td class="paramname">prefix</td><td>线程名前缀 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a071bcc9eb42b365e2ce28a32938d422e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a071bcc9eb42b365e2ce28a32938d422e">&#9670;&nbsp;</a></span>ThreadPoolExecutor() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ThreadPoolExecutor::ThreadPoolExecutor </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>corePoolSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>maxPoolSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>prefix</em> = <code>&quot;&quot;</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p><a class="el" href="classThreadPoolExecutor.html" title="线程池基本实现,每个线程都有一个任务队列 ">ThreadPoolExecutor</a> 构造函数,根据corePoolSize构造相同大小的workQueue 每个线程根据顺序将对应位置的BlockingQueue&lt;Runnable&gt; 作为自己的任务队列 会抛出异常 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">corePoolSize</td><td>核心线程数 </td></tr>
    <tr><td class="paramname">maxPoolSize</td><td>最大线程数 </td></tr>
    <tr><td class="paramname">prefix</td><td>线程名前缀 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="aa4eb0971fc6f352df594186b6a118d6c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa4eb0971fc6f352df594186b6a118d6c">&#9670;&nbsp;</a></span>addWorker() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::addWorker </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classRunnable.html">Runnable</a>&#160;</td>
          <td class="paramname"><em>task</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>core</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>addWorker 将任务添加到队列 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">task</td><td>任务 </td></tr>
    <tr><td class="paramname">core</td><td>是否使用核心线程</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>true - 添加成功 </dd></dl>

</div>
</div>
<a id="a9f108a305159ddf47923162f89a91a64"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9f108a305159ddf47923162f89a91a64">&#9670;&nbsp;</a></span>addWorker() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::addWorker </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a>&#160;</td>
          <td class="paramname"><em>task</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>core</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>addWorker 将任务添加到队列 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">task</td><td>任务 </td></tr>
    <tr><td class="paramname">core</td><td>是否使用核心线程</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>true - 添加成功 </dd></dl>

</div>
</div>
<a id="abaa3926310766a93b7fe1d83b77efdae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abaa3926310766a93b7fe1d83b77efdae">&#9670;&nbsp;</a></span>advanceRunState()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void ThreadPoolExecutor::advanceRunState </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>targetState</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>advanceRunState 改变线程池状态 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">targetState</td><td>目标状态 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ac40053b88cd669526a0a6225b5e1a86e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac40053b88cd669526a0a6225b5e1a86e">&#9670;&nbsp;</a></span>compareAndDecrementWorkerCount()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::compareAndDecrementWorkerCount </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>expect</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>compareAndDecrementWorkerCount 尝试CAS递减ctl的workerCount字段. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">expect</td><td>控制变量</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>bool </dd></dl>

</div>
</div>
<a id="ac1bcafe65f800aeb9feade5f31b64fde"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac1bcafe65f800aeb9feade5f31b64fde">&#9670;&nbsp;</a></span>compareAndIncrementWorkerCount()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::compareAndIncrementWorkerCount </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>expect</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>compareAndIncrementWorkerCount 尝试CAS递增ctl的workerCount字段. </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">expect</td><td>控制变量</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>true-成功 </dd></dl>

</div>
</div>
<a id="a5e40839bf4191b5eab9d81227ddb62c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5e40839bf4191b5eab9d81227ddb62c3">&#9670;&nbsp;</a></span>coreWorkerThread()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void ThreadPoolExecutor::coreWorkerThread </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>queueIdex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>coreWorkerThread 核心线程循环 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">queueIdex</td><td>任务队列位置 </td></tr>
  </table>
  </dd>
</dl>

<p>被 <a class="el" href="classWorkStealingThreadPoolExecutor.html#a9a9ad791af26c0809a9e1864544930aa">WorkStealingThreadPoolExecutor</a> 重载.</p>

</div>
</div>
<a id="a31ed7a73571c79c8dbb486f27a4df4eb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a31ed7a73571c79c8dbb486f27a4df4eb">&#9670;&nbsp;</a></span>ctlOf()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int32_t ThreadPoolExecutor::ctlOf </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>rs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>wc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>ctlOf 控制变量初始化 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">rs</td><td>运行状态 </td></tr>
    <tr><td class="paramname">wc</td><td>工作线程数量</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>控制变量的值 </dd></dl>

</div>
</div>
<a id="a4dac3c2435919af5d77aa36069d35bc7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4dac3c2435919af5d77aa36069d35bc7">&#9670;&nbsp;</a></span>execute() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ThreadPoolExecutor::execute </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a>&#160;</td>
          <td class="paramname"><em>command</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>core</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>execute 在将来某个时候执行给定的任务,无返回值, 任务可以在新线程或现有的合并的线程中执行, 向任务队列提交的是任务副本 不会抛出异常 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">command</td><td>要执行的任务(Runnable的子类shared_ptr), 任务执行完依然能够拿到结果 </td></tr>
    <tr><td class="paramname">core</td><td>是否使用核心线程,在核心线程没有完全启动时, 会忽略core的值,优先启动核心线程</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>true - 添加成功 </dd></dl>

</div>
</div>
<a id="a523df0545790ef03a82623b05e3b20f9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a523df0545790ef03a82623b05e3b20f9">&#9670;&nbsp;</a></span>execute() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::execute </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classRunnable.html">Runnable</a> &amp;&#160;</td>
          <td class="paramname"><em>command</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>core</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>execute 在将来某个时候执行给定的任务,无返回值, 任务可以在新线程或现有的合并的线程中执行, 向任务队列提交的是任务副本 不会抛出异常 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">command</td><td>要执行的任务(Runnable或函数或lambda),任务会被用std::move(转移), 任务结束后就会消失</td></tr>
    <tr><td class="paramname">core</td><td>是否使用核心线程,在核心线程没有完全启动时, 会忽略core的值,优先启动核心线程</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>true - 添加成功 </dd></dl>

</div>
</div>
<a id="a451bba3f90dbed2ba7e491ebc391b3c6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a451bba3f90dbed2ba7e491ebc391b3c6">&#9670;&nbsp;</a></span>execute() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::execute </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classBlockingQueue.html">BlockingQueue</a>&lt; <a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>commands</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>core</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>execute 在将来某个时候执行给定的任务,无返回值, 任务可以在新线程或现有的合并的线程中执行, 向任务队列提交的是任务副本 不会抛出异常 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">commands</td><td>要执行的任务队列 </td></tr>
    <tr><td class="paramname">core</td><td>是否使用核心线程,如果为true,任务将被平均分配给核心线程 如果为flase,新建线程执行任务队列(前提是线程池小于maxPoolSize)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>true - 任务全部放入执行队列 </dd></dl>

</div>
</div>
<a id="ac9345329aa167200bec31951d2f5a690"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac9345329aa167200bec31951d2f5a690">&#9670;&nbsp;</a></span>getActiveCount()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int ThreadPoolExecutor::getActiveCount </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>getActiveCount 返回正在执行任务的线程的大概数量 也就是非空闲线程数量 </p>
<dl class="section return"><dt>返回</dt><dd>线程数 </dd></dl>

</div>
</div>
<a id="af29377a50af53031bb06aeacf9ef27f7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af29377a50af53031bb06aeacf9ef27f7">&#9670;&nbsp;</a></span>getCorePoolSize()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int ThreadPoolExecutor::getCorePoolSize </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>getCorePoolSize 返回核心线程数 </p>
<dl class="section return"><dt>返回</dt><dd>核心线程数 </dd></dl>

</div>
</div>
<a id="af630e5117b4f67428a4fcbee5c15a7d9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af630e5117b4f67428a4fcbee5c15a7d9">&#9670;&nbsp;</a></span>getEverPoolSize()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int ThreadPoolExecutor::getEverPoolSize </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>getLargestPoolSize 返回池中使用过的线程数 </p>
<dl class="section return"><dt>返回</dt><dd>线程数 </dd></dl>

</div>
</div>
<a id="a61e8321202e6b0f6ea014485e8e10450"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a61e8321202e6b0f6ea014485e8e10450">&#9670;&nbsp;</a></span>getTaskCount()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual long ThreadPoolExecutor::getTaskCount </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>getTaskCount 得到任务队列大小 </p>
<dl class="section return"><dt>返回</dt><dd>任务队列大小 </dd></dl>

<p>被 <a class="el" href="classScheduledThreadPoolExecutor.html#a786bc8478d265dfe0288de9397c7f768">ScheduledThreadPoolExecutor</a> 重载.</p>

</div>
</div>
<a id="a841ae2189d6f85b9df9f69dec5375341"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a841ae2189d6f85b9df9f69dec5375341">&#9670;&nbsp;</a></span>isRunning()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::isRunning </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>c</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>isRunning 是否还在运行 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd></dd></dl>

</div>
</div>
<a id="ac33c356670eabe5345992331e615348c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac33c356670eabe5345992331e615348c">&#9670;&nbsp;</a></span>isShutDown()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::isShutDown </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>isShutDown 判断线程池是否shutdown </p>
<dl class="section return"><dt>返回</dt><dd></dd></dl>

</div>
</div>
<a id="a89ed68d6c67ad6fbde73b7883c8107a7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a89ed68d6c67ad6fbde73b7883c8107a7">&#9670;&nbsp;</a></span>isTerminated()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::isTerminated </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>isTerminated 判断线程池是否terminated </p>
<dl class="section return"><dt>返回</dt><dd></dd></dl>

</div>
</div>
<a id="ac2aa11f7cde6e6082eb0dde8f2385dce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac2aa11f7cde6e6082eb0dde8f2385dce">&#9670;&nbsp;</a></span>keepNonCoreThreadAlive() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::keepNonCoreThreadAlive </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>nonCoreThreadAlive 是否允许非核心线程超时,若允许则线程执行完 一个任务后不会退出,会继续存在 </p>
<dl class="section return"><dt>返回</dt><dd>ture - 允许非核心thread超时 </dd></dl>

</div>
</div>
<a id="a7e6ed2d088147377d1e82018ac3dac1d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7e6ed2d088147377d1e82018ac3dac1d">&#9670;&nbsp;</a></span>keepNonCoreThreadAlive() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void ThreadPoolExecutor::keepNonCoreThreadAlive </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>keepNonCoreThreadAlive 设置是否允许非核心thread超时并且在没有任务时终止 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">value</td><td>ture或false </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aab8b3946a87fbecd144b159c12c8bcfb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aab8b3946a87fbecd144b159c12c8bcfb">&#9670;&nbsp;</a></span>preStartCoreThreads()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int ThreadPoolExecutor::preStartCoreThreads </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>preStartCoreThreads 启动所有核心线程，导致他们等待工作。 这将覆盖仅在执行新任务时启动核心线程的默认策略 </p>
<dl class="section return"><dt>返回</dt><dd>线程数已启动 </dd></dl>

<p>被 <a class="el" href="classScheduledThreadPoolExecutor.html#aed48379bdc243fd07e593205ca28f48d">ScheduledThreadPoolExecutor</a> 重载.</p>

</div>
</div>
<a id="a14c4e3d786dcf22e858b11a95d2f77ef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a14c4e3d786dcf22e858b11a95d2f77ef">&#9670;&nbsp;</a></span>reject() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void ThreadPoolExecutor::reject </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classRunnable.html">Runnable</a> &amp;&#160;</td>
          <td class="paramname"><em>command</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>reject 将任务抛弃 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">command</td><td>要抛弃的任务 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a353e65b77bb3c0950ed79939473d4852"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a353e65b77bb3c0950ed79939473d4852">&#9670;&nbsp;</a></span>reject() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void ThreadPoolExecutor::reject </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2">Runnable::sptr</a>&#160;</td>
          <td class="paramname"><em>command</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>reject 将任务抛弃 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">command</td><td>要抛弃的任务 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a44ee48ed44faa12fc6373074e9059e4e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a44ee48ed44faa12fc6373074e9059e4e">&#9670;&nbsp;</a></span>runStateAtLeast()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::runStateAtLeast </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>s</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>runStateAtLeast 运行状态最少是 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>控制变量 </td></tr>
    <tr><td class="paramname">s</td><td>比较对象</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>bool c &lt; s </dd></dl>

</div>
</div>
<a id="aa12a3efb879080453fb7abc486585698"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa12a3efb879080453fb7abc486585698">&#9670;&nbsp;</a></span>runStateLessThan()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool ThreadPoolExecutor::runStateLessThan </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>s</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>runStateLessThan 状态低于 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>控制变量 </td></tr>
    <tr><td class="paramname">s</td><td>比较对象</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>bool c &lt; s </dd></dl>

</div>
</div>
<a id="acdb626fdcb6ed4c7822508d1e0a3fcf5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acdb626fdcb6ed4c7822508d1e0a3fcf5">&#9670;&nbsp;</a></span>runStateOf()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int ThreadPoolExecutor::runStateOf </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>c</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>runStateOf 得到线程池状态 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>控制变量</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>运行状态 </dd></dl>

</div>
</div>
<a id="ac5a10d336958ca43530b31bff81c9c4b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac5a10d336958ca43530b31bff81c9c4b">&#9670;&nbsp;</a></span>setMaxPoolSize()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void ThreadPoolExecutor::setMaxPoolSize </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>maxPoolSize</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>setMaxPoolSize 设置允许的最大线程数。 这将覆盖在构造函数中设置的任何值。 如果新值小于当前值，则过多的现有线程在下一个空闲时将被终止 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">maxPoolSize</td><td>新的最大值 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a0a471dc0a68b70d99d8215565a4df688"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0a471dc0a68b70d99d8215565a4df688">&#9670;&nbsp;</a></span>setRejectedExecutionHandler()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void ThreadPoolExecutor::setRejectedExecutionHandler </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classRejectedExecutionHandler.html">RejectedExecutionHandler</a>&#160;</td>
          <td class="paramname"><em>handler</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>setRejectedExecutionHandler 设置新的任务拒绝策略 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">handler</td><td>RejectedExecutionHandler类对象 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a94834ab6bedcc75111524fec4e928b3f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a94834ab6bedcc75111524fec4e928b3f">&#9670;&nbsp;</a></span>submit()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename F &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::future&lt;typename std::result_of&lt;F()&gt;::type&gt; ThreadPoolExecutor::submit </td>
          <td>(</td>
          <td class="paramtype">F&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>core</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>submit 在将来某个时候执行给定的任务, 任务可以在新线程或现有的合并的线程中执行, 可以有返回值,向任务队列提交的是任务副本 会抛出异常 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>要提交的任务(Runnable或函数或lambda) </td></tr>
    <tr><td class="paramname">core</td><td>是否使用核心线程(默认值true,不增加新线程), 在核心线程没有完全启动时,会忽略core的值,优先启动核心线程</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>res 任务返回值的future </dd></dl>

</div>
</div>
<a id="a8e340cec3bb976f7773db103d73189c2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8e340cec3bb976f7773db103d73189c2">&#9670;&nbsp;</a></span>toString()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual std::string ThreadPoolExecutor::toString </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>toString 返回标识此池的字符串及其状态，包括运行状态和估计的Worker和任务计数的指示 </p>
<dl class="section return"><dt>返回</dt><dd>一个标识这个池的字符串，以及它的状态 </dd></dl>

<p>被 <a class="el" href="classScheduledThreadPoolExecutor.html#a4a785e058d76dc861a23904d7e1033f0">ScheduledThreadPoolExecutor</a> 重载.</p>

</div>
</div>
<a id="a4f842d070a584bbc16a693207a947aac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4f842d070a584bbc16a693207a947aac">&#9670;&nbsp;</a></span>workerCountOf()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual int ThreadPoolExecutor::workerCountOf </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>c</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">final</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>workerCountOf 得到工作线程数量 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>控制变量</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>工作线程数量 </dd></dl>

</div>
</div>
<a id="a844902ce61fb16b11a569b8ee56e80e9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a844902ce61fb16b11a569b8ee56e80e9">&#9670;&nbsp;</a></span>workerThread()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void ThreadPoolExecutor::workerThread </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>queueIdex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>workerThread 非核心线程循环 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">queueIdex</td><td>任务队列位置 </td></tr>
  </table>
  </dd>
</dl>

<p>被 <a class="el" href="classWorkStealingThreadPoolExecutor.html#a962c0965822cd961984928ec26d61d4e">WorkStealingThreadPoolExecutor</a> 重载.</p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li><a class="el" href="threadpoolexecutor_8hpp_source.html">threadpoolexecutor.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
